<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
    <link rel="icon" type="image/jpg" href="/images/scales.jpg" />
    <title>SUJudger: <%= controller.action_name %></title>
    <% if controller.action_name == "view_problem" || controller.action_name == "submit"%>
        <%= stylesheet_link_tag controller.action_name %>
    <% end %>
    <%= stylesheet_link_tag "main" %>
    <%= javascript_include_tag :defaults %>
  </head>
  <body>
    <div class="login_status">
      <% unless logged_in? %>
        You are not curently logged in. <%= link_to "Login", :controller => "sessions", :action => "new" %> <br/>
        If you don't have account yet, then 
        <%= link_to "Register", :controller => "users", :action => "new" %>
      <% else %>
        Hello, <%= current_user.login %>!
        <%= link_to "Edit Info", :controller => "users", :action => "edit", :id => current_user.id %> |
        <%= link_to "Logout", "/logout"  %>
      <% end %>
    </div>
    
    <p style="color: green"><%= flash[:notice] %></p>
    <p style="color: red"><%= flash[:error] %></p>
    <table>
      <tr class="main">
        <td class="side_bar">
          <ul>
            <li> <%= link_to "Browse problems", :controller => "problems", :action => "index"%> </li>
            <li> <%= link_to "Judge queue", :controller => "runs", :action => "index"%> </li>
            <li> <%= link_to "Submit a problem", :controller => "runs", :action => "new"%> </li>
            <li> <%= link_to "View active contests", :controller => "contests", :action => "index", :filter => "active"%> </li>
            <li> <%= link_to "View all contests", :controller => "contests", :action => "index"%> </li>
            <% if admin? %>
              <li> <%= link_to "Main admin page", :controller => "admin", :action => "index"%> </li>
              <li> <%= link_to "Start get", :controller => "admin", :action => "start_get"%> </li>
              <li> <%= link_to "Create contest", :controller => "contests", :action => "new"%> </li>
              <li> <%= link_to "Load sources", :controller => "admin", :action => "load_source"%> </li>
            <% end %>
          </ul>
        </td>
        <td class="main_part">
          <%= yield  %>
        </td>
      </tr>
    </table>
    
  </body>
</html>